#include "widget.h"
#include "ui_widget.h"
#include <QButtonGroup>


Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    ui->radioButton->setChecked(true);
//    ui->radioButton_2->setEnabled(false);

    //设置同一组
    QButtonGroup* group1 = new QButtonGroup(this);
    QButtonGroup* group2 = new QButtonGroup(this);
    group1->addButton(ui->radioButton);
    group1->addButton(ui->radioButton_2);
    group2->addButton(ui->radioButton_3);
    group2->addButton(ui->radioButton_4);

    button = new QLabel(this);
    //设置Qlabel的属性
    button->setTextFormat(Qt::RichText);
    button->setText("<b>hello world</b>");

    button->setTextFormat(Qt::RichText);
}

Widget::~Widget()
{
    delete ui;
}


//void Widget::on_radioButton_clicked()
//{
//    ui->label_text->setText("你的性别是：男性");
//}

//void Widget::on_radioButton_2_clicked()
//{
//    ui->label_text->setText("你的性别是：女性");
//}

void Widget::on_radioButton_clicked(bool checked)
{
    qDebug() << "clicked " << checked;
}

void Widget::on_radioButton_2_pressed()
{
    qDebug() << "pressed ";
}

void Widget::on_radioButton_3_released()
{
    qDebug() << "released ";
}

void Widget::on_radioButton_4_clicked()
{
    qDebug() << "on_radioButton_4_clicked ";
}
